﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using COM.Rights.Model;
using COM.Rights.BLL;
using System.Collections;
using System.Collections.Generic;

public partial class UserControl_Reviews : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack) {
          
        }
    }

    public string StyleName
    {
        get
        {
            return CssControler.GetCssFileNameByHost(HostName);
        }
    } 

    private string _HostName;
    public string HostName
    {
        get
        {
            if (StringHelper.FormatObjToString(ViewState["HostName"]) != string.Empty)
            {
                return StringHelper.FormatObjToString(ViewState["HostName"]);
            }
            else if (!string.IsNullOrEmpty(hidHostName.Value))
            { ViewState["HostName"] = hidHostName.Value; return hidHostName.Value; }

            return this._HostName;
        }
        set
        {
            ViewState["HostName"] = value;
        }
    }

    private string _Area;
    public string Area
    {
        get
        {
            return StringHelper.FormatObjToString(ViewState["Area"]);
        }
        set
        {
            ViewState["Area"] = value;
        }
    }




    protected void imgBtnMessage_Click(object sender, ImageClickEventArgs e)
    {
        

        if ( !string.IsNullOrEmpty( ZASession.ValidateCodeComment) && txtVail.Value.ToUpper() != ZASession.ValidateCodeComment.ToUpper())
        {
            ZJScript.Alert("验证码不正确！");
            ZASession.ValidateCodeAdmin = null;
            return;
        }

        BdReviewsInfo Model = new BdReviewsInfo();
        Model.HostName = HostName;
        Model.CustomerName = txtCustomerName.Value;
        Model.Content = txtContent.Value;
        Model.IP = Request.UserHostAddress;
        Model.ReviewDate = DateTime.Now;
        Model.IsPublish = false;
        Model.Star = rblMessageType.SelectedValue;
        Model.Area = Area;
        Model.SetIsNew(true);
        BdReviews bll = new BdReviews();
        bll.InsertOrUpdate(Model, "*");
        bll.Dispose();
        this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "Save", "<script language='javascript'>alert('留言成功！');</script>");
        
    }

    
  

}